<template>
    <el-container style="height:100vh;border:0px solid #eee">
        <el-aside width="15%" style="background-color: #eee">
            <el-menu :default-openeds="['1']" background-color="#545c64" text-color="#fff" style="height: 100%;">
                <el-submenu index="1">
                    <template slot="title"><i class="el-icon-message" style="color: #eee;"></i>老人信息管理</template>
                    <el-menu-item-group>
                        <el-menu-item index="1-1">
                            <router-link :to="{path:'/indexPage',query: {loginUserId: this.ManagerId}}"
                                style="text-decoration: none;color: #eee;">
                                查看老人
                            </router-link>
                        </el-menu-item>
                        <el-menu-item index="1-2">
                            <router-link :to="{path:'/evaluate',query: {loginUserId: this.ManagerId}}" style="text-decoration: none;color: #eee;">
                                老人评估
                            </router-link>
                        </el-menu-item>
                        <el-menu-item index="1-3">
                            <router-link :to="{path:'/voluntary',query: {managerid: this.ManagerId}}"
                                style="text-decoration: none;color: #eee;">
                                待处理信息
                            </router-link>
                        </el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
                <el-menu-item index="2">
                    <i class="el-icon-setting"></i>
                    <span slot="title">管理信息设置</span>
                </el-menu-item>
            </el-menu>
        </el-aside>
        <el-container>
            <el-main>
                <div>
                    <h1 style="margin-bottom: 20px;font-size: 30px;">老人异常状态数值设置</h1>
                </div>
                <el-form :model="setDate" :rules="setDateRule" label-width="100px" class="demo-ruleForm">
                    <el-form-item label="体温低于" prop="temperdown">
                        <el-input v-model="setDate.temperdown"></el-input>
                    </el-form-item>
                    <el-form-item label="体温高于" prop="temperup">
                        <el-input v-model="setDate.temperup"></el-input>
                    </el-form-item>
                    <el-form-item label="血压低于" prop="blooddown">
                        <el-input v-model="setDate.blooddown"></el-input>
                    </el-form-item>
                    <el-form-item label="血压高于" prop="bloodup">
                        <el-input v-model="setDate.bloodup"></el-input>
                    </el-form-item>
                    <el-form-item label="心率低于" prop="heartdown">
                        <el-input v-model="setDate.heartdown"></el-input>
                    </el-form-item>
                    <el-form-item label="心率高于" prop="heartup">
                        <el-input v-model="setDate.heartup"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button @click="updateSet()">提交</el-button>
                    </el-form-item>
                </el-form>
            </el-main>
        </el-container>
    </el-container>
</template>

<script>
    import axios from 'axios';
    export default {
        data() {
            return {
                ManagerId: 0,
                setDate: {
                    temperdown: 0,
                    temperup: 0,
                    blooddown: 0,
                    bloodup: 0,
                    heartdown: 0,
                    heartup: 0
                },
                setDateRule: {
                    temperdown: [{ required: true, message: '请输入内容', trigger: 'blur' }],
                    temperup: [{ required: true, message: '请输入内容', trigger: 'blur' }],
                    blooddown: [{ required: true, message: '请输入内容', trigger: 'blur' }],
                    bloodup: [{ required: true, message: '请输入内容', trigger: 'blur' }],
                    heartdown: [{ required: true, message: '请输入内容', trigger: 'blur' }],
                    heartup: [{ required: true, message: '请输入内容', trigger: 'blur' }]
                },

            }
        },
        methods: {
            updateSet: function () {
                axios.put("http://localhost:8080/setManaSet/" + this.ManagerId, this.setDate).then(result => {
                    if (result.data.code == 1) {
                        axios.get("http://localhost:8080/getSet/" + this.ManagerId).then(result => {
                            if (result.data.code == 1) {
                                this.setDate = result.data.data;
                            }
                        })
                    }
                })
            }
        },
        mounted() {
            this.ManagerId = this.$route.query.managerid;
            axios.get("http://localhost:8080/getSet/" + this.$route.query.managerid).then(result => {
                if (result.data.code == 1) {
                    this.setDate = result.data.data;
                }
            })
        },
    }
</script>

<style scoped>
    * {
        margin: 10 auto;
        padding: 0 auto;
    }

</style>

<style>

</style>